<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
                      "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
    <meta http-equiv="content-type" content="text/html; charset=UTF-8"/>
    <title>Zend_Serializer_Adapter - Zend Framework Manual</title>

    <link href="../css/shCore.css" rel="stylesheet" type="text/css" />
    <link href="../css/shThemeDefault.css" rel="stylesheet" type="text/css" />
    <link href="../css/styles.css" media="all" rel="stylesheet" type="text/css" />
</head>
<body>
<h1>Zend Framework</h1>
<h2>Programmer's Reference Guide</h2>
<ul>
    <li><a href="../en/zend.serializer.adapter.html">Inglês (English)</a></li>
    <li><a href="../pt-br/zend.serializer.adapter.html">Português Brasileiro (Brazilian Portuguese)</a></li>
</ul>
<table width="100%">
    <tr valign="top">
        <td width="85%">
            <table width="100%">
                <tr>
                    <td width="25%" style="text-align: left;">
                    <a href="zend.serializer.introduction.html">Introduction</a>
                    </td>

                    <td width="50%" style="text-align: center;">
                        <div class="up"><span class="up"><a href="zend.serializer.html">Zend_Serializer</a></span><br />
                        <span class="home"><a href="manual.html">Guia de Refer&ecirc;ncia do Programador</a></span></div>
                    </td>

                    <td width="25%" style="text-align: right;">
                        <div class="next" style="text-align: right; float: right;"><a href="zend.server.html">Zend_Server</a></div>
                    </td>
                </tr>
            </table>
<hr />
<div id="zend.serializer.adapter" class="section"><div class="info"><h1 class="title">Zend_Serializer_Adapter</h1></div>
    

    <p class="para">
        <span class="classname">Zend_Serializer</span> adapters create a bridge for different methods of
        serializing with very little effort.
    </p>

    <p class="para">
        Every adapter has different pros and cons. In some cases, not every <acronym class="acronym">PHP</acronym>
        datatype (e.g., objects) can be converted to a string representation. In most such cases,
        the type will be converted to a similar type that is serializable -- as an example,
        <acronym class="acronym">PHP</acronym> objects will often be cast to arrays. If this fails, a
        <span class="classname">Zend_Serializer_Exception</span> will be thrown.
    </p>

    <p class="para">
        Below is a list of available adapters.
    </p>

    <div class="section" id="zend.serializer.adapter.phpserialize"><div class="info"><h1 class="title">Zend_Serializer_Adapter_PhpSerialize</h1></div>
        

        <p class="para">
            This adapter uses the built-in  <span class="methodname">un/serialize</span>
            <acronym class="acronym">PHP</acronym> functions, and is a good default adapter choice.
        </p>

        <p class="para">
            There are no configurable options for this adapter.
        </p>
    </div>

    <div class="section" id="zend.serializer.adapter.igbinary"><div class="info"><h1 class="title">Zend_Serializer_Adapter_Igbinary</h1></div>
        

        <p class="para">
            <a href="http://opensource.dynamoid.com" class="link external">&raquo; Igbinary</a> is Open Source Software
            released by Sulake Dynamoid Oy. It&#039;s a drop-in replacement for the standard
            <acronym class="acronym">PHP</acronym> serializer. Instead of time and space consuming textual
            representation, igbinary stores <acronym class="acronym">PHP</acronym> data structures in a compact
            binary form. Savings are significant when using memcached or similar memory based
            storages for serialized data.
        </p>

        <p class="para">
            You need the igbinary <acronym class="acronym">PHP</acronym> extension installed on your system in order
            to use this adapter.
        </p>

        <p class="para">
            There adapter takes no configuration options.
        </p>
    </div>

    <div class="section" id="zend.serializer.adapter.wddx"><div class="info"><h1 class="title">Zend_Serializer_Adapter_Wddx</h1></div>
        

        <p class="para">
            <a href="http://wikipedia.org/wiki/WDDX" class="link external">&raquo; WDDX</a> (Web Distributed Data eXchange)
            is a programming-language-, platform-, and transport-neutral data interchange mechanism
            for passing data between different environments and different computers.
        </p>

        <p class="para">
            The adapter simply uses the <a href="http://php.net/manual/book.wddx.php" class="link external">&raquo; wddx_*()</a> <acronym class="acronym">PHP</acronym>
            functions. Please read the <acronym class="acronym">PHP</acronym> manual to determine how you may enable
            them in your <acronym class="acronym">PHP</acronym> installation.
        </p>

        <p class="para">
            Additionally, the <a href="http://php.net/manual/book.simplexml.php" class="link external">&raquo; SimpleXML</a>
            <acronym class="acronym">PHP</acronym> extension is used to check if a returned
            <b><tt>NULL</tt></b> value from  <span class="methodname">wddx_unserialize()</span> is
            based on a serialized <b><tt>NULL</tt></b> or on invalid data.
        </p>

        <p class="para">
            Available options include:
        </p>

        <table id="zend.serializer.adapter.wddx.table.options" class="doctable table"><div class="info"><caption><b>Zend_Serializer_Adapter_Wddx Options</b></caption></div>
            

            
                 <thead valign="middle">
                      <tr valign="middle">
                          <th>Option</th>
                          <th>Data Type</th>
                          <th>Default Value</th>
                          <th>Description</th>
                    </tr>

                 </thead>


                 <tbody valign="middle" class="tbody">
                      <tr valign="middle">
                          <td align="left"><em class="emphasis">comment</em></td>
                          <td align="left"><span class="type">string</span></td>
                          <td class="empty">&nbsp;</td>
                          <td align="left">An optional comment that appears in the packet header.</td>
                      </tr>

                  </tbody>
             
        </table>

    </div>

    <div class="section" id="zend.serializer.adapter.json"><div class="info"><h1 class="title">Zend_Serializer_Adapter_Json</h1></div>
        

        <p class="para">
            The <acronym class="acronym">JSON</acronym> adapter provides a bridge to the
            <span class="classname">Zend_Json</span> component and/or ext/json. Please read the <a href="zend.json.introduction.html" class="link">Zend_Json documentation</a> for further
            information.
        </p>

        <p class="para">
            Available options include:
        </p>

        <table id="zend.serializer.adapter.json.table.options" class="doctable table"><div class="info"><caption><b>Zend_Serializer_Adapter_Json Options</b></caption></div>
            

            
                 <thead valign="middle">
                      <tr valign="middle">
                        <th>Option</th>
                        <th>Data Type</th>
                        <th>Default Value</th>
                        <th>Description</th>
                    </tr>

                 </thead>


                 <tbody valign="middle" class="tbody">
                      <tr valign="middle">
                          <td align="left"><em class="emphasis">cycleCheck</em></td>
                          <td align="left"><span class="type">boolean</span></td>
                          <td align="left">false</td>

                          <td align="left">
                              See <a href="zend.json.advanced.html#zend.json.advanced.objects1" class="link">this section</a>
                          </td>
                      </tr>


                      <tr valign="middle">
                          <td align="left"><em class="emphasis">objectDecodeType</em></td>
                          <td align="left"><span class="type">Zend_Json::TYPE_*</span></td>
                          <td align="left">Zend_Json::TYPE_ARRAY</td>

                          <td align="left">
                              See <a href="zend.json.advanced.html#zend.json.advanced.objects1" class="link">this section</a>
                          </td>
                      </tr>


                      <tr valign="middle">
                          <td align="left"><em class="emphasis">enableJsonExprFinder</em></td>
                          <td align="left"><span class="type">boolean</span></td>
                          <td align="left">false</td>

                          <td align="left">
                              See <a href="zend.json.advanced.html#zend.json.advanced.expr" class="link">this section</a>
                          </td>
                      </tr>

                  </tbody>
             
        </table>

    </div>

    <div class="section" id="zend.serializer.adapter.amf03"><div class="info"><h1 class="title">Zend_Serializer_Adapter_Amf 0 and 3</h1></div>
        

        <p class="para">
            The <acronym class="acronym">AMF</acronym> adapters, <span class="classname">Zend_Serializer_Adapter_Amf0</span>
            and <span class="classname">Zend_Serializer_Adapter_Amf3</span>, provide a bridge to the
            serializer of the <span class="classname">Zend_Amf</span> component. Please read the <a href="zend.amf.introduction.html" class="link">Zend_Amf documentation</a> for further
            information.
        </p>

        <p class="para">
            There are no options for these adapters.
        </p>
    </div>

    <div class="section" id="zend.serializer.adapter.pythonpickle"><div class="info"><h1 class="title">Zend_Serializer_Adapter_PythonPickle</h1></div>
        

        <p class="para">
            This adapter converts <acronym class="acronym">PHP</acronym> types to a <a href="http://docs.python.org/library/pickle.html" class="link external">&raquo; Python Pickle</a> string
            representation. With it, you can read the serialized data with Python and read Pickled
            data of Python with <acronym class="acronym">PHP</acronym>.
        </p>

        <p class="para">
            Available options include:
        </p>

        <table id="zend.serializer.adapter.pythonpickle.table.options" class="doctable table"><div class="info"><caption><b>Zend_Serializer_Adapter_PythonPickle Options</b></caption></div>
            

            
                 <thead valign="middle">
                      <tr valign="middle">
                        <th>Option</th>
                        <th>Data Type</th>
                        <th>Default Value</th>
                        <th>Description</th>
                    </tr>

                 </thead>


                 <tbody valign="middle" class="tbody">
                      <tr valign="middle">
                          <td align="left"><em class="emphasis">protocol</em></td>
                          <td align="left"><span class="type">integer</span> (0 | 1 | 2 | 3)</td>
                          <td align="left">0</td>

                          <td align="left">
                               The Pickle protocol version used on
                                <span class="methodname">serialize</span>
                          </td>
                      </tr>

                  </tbody>
             
        </table>


        <p class="para">
            Datatype merging (PHP to Python) occurs as follows:
        </p>

        <table id="zend.serializer.adapter.pythonpickle.table.php2python" class="doctable table"><div class="info"><caption><b>Datatype merging (PHP to Python)</b></caption></div>
            

            
                 <thead valign="middle">
                      <tr valign="middle">
                        <th>PHP Type</th>
                        <th>Python Type</th>
                    </tr>

                 </thead>


                 <tbody valign="middle" class="tbody">
                      <tr valign="middle">
                          <td align="left"><span class="type">NULL</span></td>
                          <td align="left"><span class="type">None</span></td>
                      </tr>


                      <tr valign="middle">
                          <td align="left"><span class="type">boolean</span></td>
                          <td align="left"><span class="type">boolean</span></td>
                      </tr>


                      <tr valign="middle">
                          <td align="left"><span class="type">integer</span></td>
                          <td align="left"><span class="type">integer</span></td>
                      </tr>


                      <tr valign="middle">
                          <td align="left"><span class="type">float</span></td>
                          <td align="left"><span class="type">float</span></td>
                      </tr>


                      <tr valign="middle">
                          <td align="left"><span class="type">string</span></td>
                          <td align="left"><span class="type">string</span></td>
                      </tr>


                      <tr valign="middle">
                          <td align="left"><span class="type">array</span></td>
                          <td align="left"><span class="type">list</span></td>
                      </tr>


                      <tr valign="middle">
                          <td align="left"><span class="type">associative array</span></td>
                          <td align="left"><span class="type">dictionary</span></td>
                      </tr>


                      <tr valign="middle">
                          <td align="left"><span class="type">object</span></td>
                          <td align="left"><span class="type">dictionary</span></td>
                      </tr>

                  </tbody>
             
        </table>


        <p class="para">
            Datatype merging (Python to <acronym class="acronym">PHP</acronym>) occurs per the following:
        </p>

        <table id="zend.serializer.adapter.pythonpickle.table.python2php" class="doctable table"><div class="info"><caption><b>Datatype merging (Python to PHP)</b></caption></div>
            

            
                 <thead valign="middle">
                      <tr valign="middle">
                        <th>Python-Type</th>
                        <th>PHP-Type</th>
                    </tr>

                 </thead>


                 <tbody valign="middle" class="tbody">
                      <tr valign="middle">
                          <td align="left"><span class="type">None</span></td>
                          <td align="left"><span class="type">NULL</span></td>
                      </tr>


                      <tr valign="middle">
                          <td align="left"><span class="type">boolean</span></td>
                          <td align="left"><span class="type">boolean</span></td>
                      </tr>


                      <tr valign="middle">
                          <td align="left"><span class="type">integer</span></td>
                          <td align="left"><span class="type">integer</span></td>
                      </tr>


                      <tr valign="middle">
                          <td align="left"><span class="type">long</span></td>

                          <td align="left">
                              <span class="type">integer</span> | <span class="type">float</span> | <span class="type">string</span>
                              | <span class="classname">Zend_Serializer_Exception</span>
                          </td>
                      </tr>


                      <tr valign="middle">
                          <td align="left"><span class="type">float</span></td>
                          <td align="left"><span class="type">float</span></td>
                      </tr>


                      <tr valign="middle">
                          <td align="left"><span class="type">string</span></td>
                          <td align="left"><span class="type">string</span></td>
                      </tr>


                      <tr valign="middle">
                          <td align="left"><span class="type">bytes</span></td>
                          <td align="left"><span class="type">string</span></td>
                      </tr>


                      <tr valign="middle">
                          <td align="left"><span class="type">Unicode string</span></td>
                          <td align="left"><span class="type">UTF-8 string</span></td>
                      </tr>


                      <tr valign="middle">
                          <td align="left"><span class="type">list</span></td>
                          <td align="left"><span class="type">array</span></td>
                      </tr>


                      <tr valign="middle">
                          <td align="left"><span class="type">tuple</span></td>
                          <td align="left"><span class="type">array</span></td>
                      </tr>


                      <tr valign="middle">
                          <td align="left"><span class="type">dictionary</span></td>
                          <td align="left"><span class="type">associative array</span></td>
                      </tr>


                      <tr valign="middle">
                          <td align="left">All other types</td>
                          <td align="left"><span class="classname">Zend_Serializer_Exception</span></td>
                      </tr>

                  </tbody>
             
        </table>

    </div>

    <div class="section" id="zend.serializer.adapter.phpcode"><div class="info"><h1 class="title">Zend_Serializer_Adapter_PhpCode</h1></div>
        

        <p class="para">
            This adapter generates a parsable <acronym class="acronym">PHP</acronym> code representation using
            <a href="http://php.net/manual/function.var-export.php" class="link external">&raquo; var_export()</a>. On
            restoring, the data will be executed using <a href="http://php.net/manual/function.eval.php" class="link external">&raquo; eval</a>.
        </p>

        <p class="para">
            There are no configuration options for this adapter.
        </p>

        <div class="warning"><b class="warning">Warning</b><div class="info"><h1 class="title">Unserializing objects</h1></div>
            

            <p class="para">
                Objects will be serialized using the <a href="http://php.net/manual/language.oop5.magic.php#language.oop5.magic.set-state" class="link external">&raquo; __set_state</a>
                magic method. If the class doesn&#039;t implement this method, a fatal error will occur
                during execution.
            </p>
        </div>

        <div class="warning"><b class="warning">Warning</b><div class="info"><h1 class="title">Uses eval()</h1></div>
            

            <p class="para">
                The <span class="classname">PhpCode</span> adapter utilizes  <span class="methodname">eval()</span>
                to unserialize. This introduces both a performance and potential security issue as a
                new process will be executed. Typically, you should use the
                 <span class="methodname">PhpSerialize</span> adapter unless you require human-readability
                of the serialized data.
            </p>
        </div>
    </div>
</div>
        <hr />

            <table width="100%">
                <tr>
                    <td width="25%" style="text-align: left;">
                    <a href="zend.serializer.introduction.html">Introduction</a>
                    </td>

                    <td width="50%" style="text-align: center;">
                        <div class="up"><span class="up"><a href="zend.serializer.html">Zend_Serializer</a></span><br />
                        <span class="home"><a href="manual.html">Guia de Refer&ecirc;ncia do Programador</a></span></div>
                    </td>

                    <td width="25%" style="text-align: right;">
                        <div class="next" style="text-align: right; float: right;"><a href="zend.server.html">Zend_Server</a></div>
                    </td>
                </tr>
            </table>
</td>
        <td style="font-size: smaller;" width="15%"> <style type="text/css">
#leftbar {
	float: left;
	width: 186px;
	padding: 5px;
	font-size: smaller;
}
ul.toc {
	margin: 0px 5px 5px 5px;
	padding: 0px;
}
ul.toc li {
	font-size: 85%;
	margin: 1px 0 1px 1px;
	padding: 1px 0 1px 11px;
	list-style-type: none;
	background-repeat: no-repeat;
	background-position: center left;
}
ul.toc li.header {
	font-size: 115%;
	padding: 5px 0px 5px 11px;
	border-bottom: 1px solid #cccccc;
	margin-bottom: 5px;
}
ul.toc li.active {
	font-weight: bold;
}
ul.toc li a {
	text-decoration: none;
}
ul.toc li a:hover {
	text-decoration: underline;
}
</style>
 <ul class="toc">
  <li class="header home"><a href="manual.html">Guia de Refer&ecirc;ncia do Programador</a></li>
  <li class="header up"><a href="manual.html">Guia de Refer&ecirc;ncia do Programador</a></li>
  <li class="header up"><a href="reference.html">Refer&ecirc;ncia do Zend Framework</a></li>
  <li class="header up"><a href="zend.serializer.html">Zend_Serializer</a></li>
  <li><a href="zend.serializer.introduction.html">Introduction</a></li>
  <li class="active"><a href="zend.serializer.adapter.html">Zend_Serializer_Adapter</a></li>
 </ul>
 </td>
    </tr>
</table>

<script type="text/javascript" src="../js/shCore.js"></script>
<script type="text/javascript" src="../js/shAutoloader.js"></script>
<script type="text/javascript" src="../js/main.js"></script>

</body>
</html>